﻿using System;
using System.Collections;
using System.Xml;
using InfoJetSoft.Service.Entity;
using InfoJetSoft.Service.Util;

namespace InfoJetSoft.Service.Worker
{
	//对所有@select和@test进行格式化.主要就是在.Net 1.1 中去掉Nz.
	class XSNViewFormatExprWorker
	{
		
		public static void  formatExpr(View view)
		{
			//CID 0441 //2009.10.23 //Begin
			if( System.Environment.Version.Major >= 2 )
			{
				return;
			}
			//CID 0441 //2009.10.23 //End

			XmlElement root = view.Doc.DocumentElement;

			XmlNodeList selectAttrList = DOMUtil.selectNodes( root, "//@select", 0, view.NsResolver );
			foreach( XmlAttribute selectAttr in selectAttrList )
			{
				selectAttr.Value = ExpressionUtil.formatExpression( selectAttr.Value );
			}

			XmlNodeList testAttrList = DOMUtil.selectNodes( root, "//@test", 0, view.NsResolver );
			foreach( XmlAttribute testAttr in testAttrList )
			{
				testAttr.Value = ExpressionUtil.formatExpression( testAttr.Value );
			}
		}
		
	}
}